﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;

namespace YYS
{
    /// <summary>
    /// Key Value Mark
    /// </summary>
    public class KVM
    {
        public KVM() { }
        public KVM(string _Key, string _Value)
        {
            this.Key = _Key;
            this.Value = _Value;
        }
        public KVM(string _Key, string _Value, string _Mark)
        {
            this.Key = _Key;
            this.Value = _Value;
            this.Mark = _Mark;
        }
        public string Key { get; set; }
        public string Value { get; set; }
        public string Mark { get; set; }
    }

    /// <summary>
    /// key value  key is T
    /// </summary>
    [DataContract(Name = "{0}_Key")]
    public class TKey<T>
    {
        public TKey()
        { 

        }
        public TKey(T __Key, string __Value)
        {
            Key = __Key;
            Value = __Value;
        }
        [DataMember]
        public T Key { get; set; }
        [DataMember]
        public string Value { get; set; }
    }
    public class TKeys<T> : ObservableCollection<TKey<T>> { }

    public class ShortNullKey : ObservableCollection<TKey<short?>> { }
    public class IntNullKey : ObservableCollection<TKey<int?>> { }
    public class StringKey : ObservableCollection<TKey<string>> { }
    public class IntKey : ObservableCollection<TKey<int>> { }
    public class ShortKey : ObservableCollection<TKey<short>> { }

    [System.Xml.Serialization.XmlRoot("KeyValue")]
    [DataContract(Name = "{0}_KeyValue")]
    public class KeyValue<TKey, TValue>
    {
        public KeyValue() { }
        public KeyValue(TKey _key, TValue _value)
        {
            Key = _key;
            Value = _value;
        }
        TKey _Key;
        [System.Xml.Serialization.XmlElement("Key")]
        [DataMember]
        public TKey Key
        {
            get { return _Key; }
            set { _Key = value; }
        }
        TValue _Value;
        [System.Xml.Serialization.XmlElement("Value")]
        [DataMember]
        public TValue Value
        {
            get { return _Value; }
            set { _Value = value; }
        }
    }
}
